<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <script src="../plugins/echarts/echarts.js"></script>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>统计分析<small>每日预约到诊数量统计</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>每日预约到诊数量统计</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <!--            <div class="block" id="chart2">-->
            <span class="demonstration">日期选择</span>
            <el-date-picker
                    v-model="value1"
                    type="daterange"
                    align="right"
                    unlink-panels
                    range-separator="至"
                    :start-placeholder="startPlaceholder"
                    :end-placeholder="endPlaceholder"
                    value-format="yyyy-MM-dd"
                    :picker-options="pickerOptions">
            </el-date-picker>
            <input type="button" @click="wasc()" value="查询">
            <!--            </div>-->
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart1" style="height:600px;"></div>

        </div>
    </div>

</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript">

    var  vue = new Vue({
        el: '#app',
        data:{
            pickerOptions: {
                shortcuts: [{
                    text: '最近一周',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }]
            },
            startPlaceholder: new Date(new Date().getTime()-7*24*60*60*1000).getFullYear()+'-'

                +((new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1)>=10?
                    (new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1):
                    "0"+ (new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1))+'-'+

                ((new Date(new Date().getTime()-6*24*60*60*1000).getDate())>=10?
                    (new Date(new Date().getTime()-6*24*60*60*1000).getDate()):
                    "0"+(new Date(new Date().getTime()-6*24*60*60*1000).getDate())),

            endPlaceholder: new Date().getFullYear()+'-'+
                ((new Date().getMonth()+1)>=10?(new Date().getMonth()+1):"0"+((new Date().getMonth()+1)))+'-'+
                (((new Date().getDate())>=10?(new Date().getDate()):"0"+((new Date().getDate())))),

            value1:''
        },
        methods:{
            wasc(){
                if (this.value1!=''){
                    //alert(this.value1);
                    axios.post("/order/findOrderDateValue.do?value1=" + this.value1).then((res) => {
                        //alert(res.data.data)
                        if (res.data.flag) {
                            echarts.init(document.getElementById('chart1')).setOption({
                                title: {
                                    text: '到诊数量',
                                },
                                tooltip: {
                                    trigger: 'axis'
                                },
                                legend: {
                                    data: ['预约数量', '到诊数量']
                                },
                                grid: {
                                    left: '3%',
                                    right: '4%',
                                    bottom: '3%',
                                    containLabel: false
                                },
                                xAxis: {
                                    type: 'category',
                                    boundaryGap: false,
                                    data: res.data.data.dayList
                                },
                                yAxis: {
                                    type: 'value'
                                },
                                series: [
                                    {
                                        name: '预约数量',
                                        type: 'line',
                                        stack: '总量',
                                        data: res.data.data.orderList
                                    },
                                    {
                                        name: '到诊数量',
                                        type: 'line',
                                        stack: '总量',
                                        data: res.data.data.orderStatus
                                    }
                                ]
                            });
                        } else {
                            this.$message.error(res.data.message);
                        }
                    });
                }else {

                    this.$message.error("请选择一个时间段");
                    return false;

                }
                //alert(this.value1);
            },
        },

    });
    // /order/findOrderDate.do
    axios.get("/order/findOrderDate.do").then((res) => {
        //alert("默认")
        echarts.init(document.getElementById('chart1')).setOption({
            title: {
                text: '到诊数量',
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['到诊数量', '预约数量']
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: false
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: res.data.data.dayList
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name: '到诊数量',
                    type: 'line',
                    stack: '总量',
                    data: res.data.data.orderStatus
                },
                {
                    name: '预约数量',
                    type: 'line',
                    stack: '总量',
                    data: res.data.data.orderList
                }
            ]
        });
    });
</script>
</html>


<!--<!DOCTYPE html>-->
<!--<html>-->
<!--<head>-->
<!--    &lt;!&ndash; 页面meta &ndash;&gt;-->
<!--    <meta charset="utf-8">-->
<!--    <meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<!--    <title>传智健康</title>-->
<!--    <meta name="description" content="传智健康">-->
<!--    <meta name="keywords" content="传智健康">-->
<!--    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">-->
<!--    &lt;!&ndash; 引入样式 &ndash;&gt;-->
<!--    <link rel="stylesheet" href="../css/style.css">-->
<!--    <link rel="stylesheet" href="../plugins/elementui/index.css">-->
<!--    <script src="../plugins/echarts/echarts.js"></script>-->
<!--</head>-->
<!--<body class="hold-transition">-->
<!--<div id="app">-->
<!--    <div class="content-header">-->
<!--        <h1>统计分析<small>每日预约到诊数量统计</small></h1>-->
<!--        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">-->
<!--            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>-->
<!--            <el-breadcrumb-item>统计分析</el-breadcrumb-item>-->
<!--            <el-breadcrumb-item>每日预约到诊数量统计</el-breadcrumb-item>-->
<!--        </el-breadcrumb>-->
<!--    </div>-->
<!--    <div class="app-container">-->
<!--        <div class="box">-->
<!--&lt;!&ndash;            <div class="block" id="chart2">&ndash;&gt;-->
<!--                <span class="demonstration">日期选择</span>-->
<!--            <el-date-picker-->
<!--                    v-model="value1"-->
<!--                    type="daterange"-->
<!--                    align="right"-->
<!--                    unlink-panels-->
<!--                    range-separator="至"-->
<!--                    :start-placeholder="startPlaceholder"-->
<!--                    :end-placeholder="endPlaceholder"-->
<!--                    value-format="yyyy-MM-dd"-->
<!--                    :picker-options="pickerOptions">-->
<!--            </el-date-picker>-->
<!--            <input type="button" @click="wasc()" value="查询">-->
<!--&lt;!&ndash;            </div>&ndash;&gt;-->
<!--            &lt;!&ndash; 为 ECharts 准备一个具备大小（宽高）的 DOM &ndash;&gt;-->
<!--            <div id="chart1" style="height:600px;"></div>-->

<!--        </div>-->
<!--    </div>-->

<!--</div>-->
<!--</body>-->
<!--&lt;!&ndash; 引入组件库 &ndash;&gt;-->
<!--<script src="../js/vue.js"></script>-->
<!--<script src="../js/axios-0.18.0.js"></script>-->
<!--<script src="../plugins/elementui/index.js"></script>-->
<!--<script type="text/javascript">-->

<!--    var  vue = new Vue({-->
<!--        el: '#app',-->
<!--        data:{-->
<!--            pickerOptions: {-->
<!--                    shortcuts: [{-->
<!--                        text: '最近一周',-->
<!--                        onClick(picker) {-->
<!--                            const end = new Date();-->
<!--                            const start = new Date();-->
<!--                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);-->
<!--                            picker.$emit('pick', [start, end]);-->
<!--                        }-->
<!--                    }, {-->
<!--                        text: '最近一个月',-->
<!--                        onClick(picker) {-->
<!--                            const end = new Date();-->
<!--                            const start = new Date();-->
<!--                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);-->
<!--                            picker.$emit('pick', [start, end]);-->
<!--                        }-->
<!--                    }, {-->
<!--                        text: '最近三个月',-->
<!--                        onClick(picker) {-->
<!--                            const end = new Date();-->
<!--                            const start = new Date();-->
<!--                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);-->
<!--                            picker.$emit('pick', [start, end]);-->
<!--                        }-->
<!--                    }]-->
<!--                },-->
<!--            startPlaceholder: new Date(new Date().getTime()-7*24*60*60*1000).getFullYear()+'-'-->

<!--                +((new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1)>=10?-->
<!--                    (new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1):-->
<!--                "0"+ (new Date(new Date().getTime()-7*24*60*60*1000).getMonth()+1))+'-'+-->

<!--                ((new Date(new Date().getTime()-6*24*60*60*1000).getDate())>=10?-->
<!--                    (new Date(new Date().getTime()-6*24*60*60*1000).getDate()):-->
<!--                "0"+(new Date(new Date().getTime()-6*24*60*60*1000).getDate())),-->

<!--            endPlaceholder: new Date().getFullYear()+'-'+-->
<!--                ((new Date().getMonth()+1)>=10?(new Date().getMonth()+1):"0"+((new Date().getMonth()+1)))+'-'+-->
<!--                (((new Date().getDate())>=10?(new Date().getDate()):"0"+((new Date().getDate())))),-->

<!--            value1:''-->
<!--        },-->
<!--        methods:{-->
<!--            wasc(){-->
<!--                    if (this.value1!=''){-->
<!--                        //alert(this.value1);-->
<!--                        axios.post("/order/findOrderDateValue.do?value1=" + this.value1).then((res) => {-->
<!--                            //alert(res.data.data)-->
<!--                            if (res.data.flag) {-->
<!--                                echarts.init(document.getElementById('chart1')).setOption({-->
<!--                                    title: {-->
<!--                                        text: '到诊数量',-->
<!--                                    },-->
<!--                                    tooltip: {-->
<!--                                        trigger: 'axis'-->
<!--                                    },-->
<!--                                    legend: {-->
<!--                                        data: ['预约数量', '到诊数量']-->
<!--                                    },-->
<!--                                    grid: {-->
<!--                                        left: '3%',-->
<!--                                        right: '4%',-->
<!--                                        bottom: '3%',-->
<!--                                        containLabel: false-->
<!--                                    },-->
<!--                                    xAxis: {-->
<!--                                        type: 'category',-->
<!--                                        boundaryGap: false,-->
<!--                                        data: res.data.data.dayList-->
<!--                                    },-->
<!--                                    yAxis: {-->
<!--                                        type: 'value'-->
<!--                                    },-->
<!--                                    series: [-->
<!--                                        {-->
<!--                                            name: '预约数量',-->
<!--                                            type: 'line',-->
<!--                                            stack: '总量',-->
<!--                                            data: res.data.data.orderList-->
<!--                                        },-->
<!--                                        {-->
<!--                                            name: '到诊数量',-->
<!--                                            type: 'line',-->
<!--                                            stack: '总量',-->
<!--                                            data: res.data.data.orderStatus-->
<!--                                        }-->
<!--                                    ]-->
<!--                                });-->
<!--                            } else {-->
<!--                                this.$message.error(res.data.message);-->
<!--                            }-->
<!--                        });-->
<!--                    }else {-->

<!--                        this.$message.error("请选择一个时间段");-->
<!--                        return false;-->

<!--                    }-->
<!--                //alert(this.value1);-->
<!--            },-->
<!--        },-->

<!--    });-->
<!--    // /order/findOrderDate.do-->
<!--    axios.get("/order/findOrderDate.do").then((res) => {-->
<!--        //alert("默认")-->
<!--        echarts.init(document.getElementById('chart1')).setOption({-->
<!--            title: {-->
<!--                text: '到诊数量',-->
<!--            },-->
<!--            tooltip: {-->
<!--                trigger: 'axis'-->
<!--            },-->
<!--            legend: {-->
<!--                data: ['到诊数量', '预约数量']-->
<!--            },-->
<!--            grid: {-->
<!--                left: '3%',-->
<!--                right: '4%',-->
<!--                bottom: '3%',-->
<!--                containLabel: false-->
<!--            },-->
<!--            xAxis: {-->
<!--                type: 'category',-->
<!--                boundaryGap: false,-->
<!--                data: res.data.data.dayList-->
<!--            },-->
<!--            yAxis: {-->
<!--                type: 'value'-->
<!--            },-->
<!--            series: [-->
<!--                {-->
<!--                    name: '到诊数量',-->
<!--                    type: 'line',-->
<!--                    stack: '总量',-->
<!--                    data: res.data.data.orderStatus-->
<!--                },-->
<!--                {-->
<!--                    name: '预约数量',-->
<!--                    type: 'line',-->
<!--                    stack: '总量',-->
<!--                    data: res.data.data.orderList-->
<!--                }-->
<!--            ]-->
<!--        });-->
<!--    });-->
<!--</script>-->
<!--</html>-->
